/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once


#include "Mesh.h"
#include "Surface.h"
#include "引擎枚举数据.h"
#include "core/shader_line.h"



//S_Mesh板载缓存* f_构建网格板载内存(S_设备环境& ctx);
void        f_surface_初始化GPU内存(S_设备环境& ctx);
void        f_surface_释放所有GPU内存();

S_Mesh*		f_surface_创建网格对象(const S_Mesh* fromesh, S_设备环境& ctx, E_网格数据枚举 type = E_网格数据枚举::e_Mesh_CPU);
S_Mesh*		f_surface_创建网格对象(E_网格数据枚举 type = E_网格数据枚举::e_Mesh_CPU);
S_Mesh*		f_surface_创建网格对象(S_设备环境& ctx, E_网格数据枚举 type = E_网格数据枚举::e_Mesh_CPU);
void		f_surface_释放网格(S_Mesh* mesh);

S_Mesh*			f_surface_创建实例(S_Mesh* 源, bool 关联颜色 = true);
void			f_surface_关联实例(S_Mesh* mesh, const S_Mesh* 源);
void			f_surface_Copy(S_Mesh* mesh, S_Mesh* 源);

S_2D画布*		f_surface_创建2D画布(const S_2D画布* fromesh, S_设备环境& ctx);
void			f_surface_释放2D画布(S_2D画布* fromesh);


void f_surface_重置顶点数量(S_Mesh* mesh, uint64 num);
void f_surface_fill顶点数据(S_Mesh* mesh, const std::vector<vec3>& data, uint32 vertFlags);
void f_填充颜色数据(S_Mesh* mesh, const std::vector<S_RGBA8UI>& col);
//oid f_填充法线数据(S_Mesh* mesh, const std::vector<vec3>& data);
//void f_填充索引数据(S_Mesh* mesh, const std::vector<uint32>& data);
uint32 f_surface_fill顶点数据(S_Mesh* mesh, const std::vector<S_VNT1>& data);
uint32 f_surface_fill顶点数据(S_Mesh* mesh, const std::vector<S_VN>& data);
uint32 f_surface_fill顶点数据(S_Mesh* mesh, const std::vector<S_VC>& data);
//void f_surface_fill顶点数据(S_Mesh* mesh, const vec3* data, uint32 num);





template<typename T>
void f_填充顶点数据(S_Mesh* mesh, const std::vector<T>& data) {
	mesh->f_填充顶点数据(sizeof(T), data.size(), (void*)data.data());
}
template<typename T>
void f_填充顶点数据(S_Mesh* mesh, const T* data, uint32 num) {
	mesh->f_填充顶点数据(sizeof(T), num, (void*)data);
}
template<typename T>
void f_填充索引数据(S_Mesh* mesh, const std::vector<T>& data) {
	switch (sizeof(T)) {
		case sizeof(uint32) :
			mesh->f_填充索引数据(sizeof(T), data.size(), (void*)data.data());
			break;

		case sizeof(uvec3) :
			mesh->f_填充索引数据(sizeof(uvec3), data.size(), (void*)data.data());
			break;

	}
}

Inline void f_surface_fill顶点数据(S_Mesh* mesh, const std::vector<vec3>& data) {
	if(data.size()) mesh->f_fill顶点(data.data(), data.size());
	else mesh->f_Clear();
}
inline void f_surface_fill顶点数据(S_Mesh* mesh, const vec3* data, uint32 num) {
	if (num) f_填充顶点数据(mesh, data, num);
	else mesh->f_Clear();
}
Inline void f_surface_fill顶点数据(S_Mesh* mesh, const std::vector<vec4>& data) {
	if (data.size()) f_填充顶点数据<vec4>(mesh, data);
	else mesh->f_Clear();
}
Inline void f_surface_fill顶点数据(S_Mesh* mesh, const std::vector<S_VecSphere>& data) {
	if (data.size()) f_填充顶点数据<S_VecSphere>(mesh, data);
	else mesh->f_Clear();
}
Inline void f_surface_fill顶点数据(S_Mesh* mesh, S_线段& data) {
	mesh->f_填充顶点数据(sizeof(vec3), 2, (void*)&data);
}
Inline void f_surface_fill顶点数据(S_Mesh* mesh, const std::vector<S_线段>& data) {
	if (data.size()) mesh->f_填充顶点数据(sizeof(vec3), data.size() * 2, (void*)data.data());
	else mesh->f_Clear();
}
Inline void f_surface_fill顶点数据(S_Mesh* mesh, const std::vector<S_Cube>& data) {
	if (data.size()) f_填充顶点数据<S_Cube>(mesh, data);
	else mesh->f_Clear();
}
Inline void f_surface_fill法线数据(S_Mesh* mesh, const std::vector<vec3>& data) {
	if (data.size()) mesh->f_fill法线(data.data(), data.size());
}
inline void f_surface_fill法线数据(S_Mesh* mesh, const vec3* data, uint32 num) {
	if (num) mesh->f_fill法线(data, num);
	else mesh->f_Clear();
}
Inline void f_surface_fill纹理坐标(S_Mesh* mesh, const std::vector<vec2>& data) {
	if (data.size()) mesh->f_fillUV(data.data(), data.size(), 0);
}
Inline void f_surface_fill纹理坐标(S_Mesh* mesh, vec2* data, uint32 num, uint32 layer = 0) {
	if (num) mesh->f_fillUV(data, num, layer);
}
Inline void f_surface_fill索引数据(S_Mesh* mesh, const std::vector<uvec3>& data) {
	if (data.size()) f_填充索引数据<uvec3>(mesh, data);
	else mesh->f_Clear();
}
Inline void f_surface_fill索引数据(S_Mesh* mesh, const std::vector<uint32>& data) {
	if (data.size()) f_填充索引数据<uint32>(mesh, data);
	else mesh->f_Clear();
}
Inline void f_surface_fill索引数据(S_Mesh* mesh, const uint32* data, uint32 num)  {
	if (num) mesh->f_填充索引数据(sizeof(uint32), num, (void*)data);
	else mesh->f_Clear();
}
Inline void f_surface_fillUV索引数据(S_Mesh* mesh, const uint32* data, uint32 num) {
	f_gbuf_fill(*mesh->m_UV索引, data, 0, num);
}
Inline void f_surface_fill顶点权重(S_Mesh* mesh, const std::vector<float32>& 权重, const std::vector<uint32>& 骨骼ID, const S_骨骼属性& 骨头属性) {
	//mesh->m_骨骼 = (S_骨骼*)malloc(sizeof(S_骨骼));
	mesh->f_fill权重(权重.data(), 权重.size());
	mesh->f_fill骨骼ID(骨骼ID.data(), 骨骼ID.size());
	mesh->f_fill骨骼属性(骨头属性);
}

#define f_surface_fill虚线 f_surface_fill顶点数据
/*Inline void f_surface_fill索引数据(S_Mesh* mesh, const uvec3* data, uint32 num) {
	if (num) mesh->f_填充索引数据(sizeof(uvec3), num, (void*)data);
	else mesh->f_Clear();
}*/
void f_surface_fill顶点颜色(S_Mesh* mesh, const S_RGBA8UI& data);
void f_surface_fill顶点颜色(S_Mesh* mesh, const std::vector<S_RGBA8UI>& data, uint32 offset);
void f_surface_fill顶点颜色(S_Mesh* mesh, const S_RGBA8UI& data, uint32 offset, uint32 num);



Inline void f_surface_set顶点数据(S_Mesh* mesh, const std::vector<vec3>& data) {
	if (data.size() > mesh->m_顶点->m_Mem.m_大小 || data.size() < mesh->m_顶点->m_Mem.m_大小) return;
	if (data.size()) mesh->f_fill顶点(data.data(), data.size());
}

Inline void f_surface_set法线数据(S_Mesh* mesh, const std::vector<vec3>& data) {
	if (data.size() > mesh->m_顶点->m_Mem.m_大小 || data.size() < mesh->m_顶点->m_Mem.m_大小) return;
	if (data.size()) mesh->f_fill法线(data.data(), data.size());
}

Inline void f_surface_fill顶点数据(S_Mesh* mesh, const S_Vec3Array* data) {
	if (data->count > mesh->m_顶点->m_Mem.m_大小) return;
	if (data->count) mesh->f_fill顶点(data->ptr_userData, data->count);
}

Inline void f_surface_fill法线数据(S_Mesh* mesh, const S_Vec3Array* data) {
	if (data->count > mesh->m_顶点->m_Mem.m_大小) return;
	if (data->count) mesh->f_fill法线(data->ptr_userData, data->count);
}


void f_surface_get网格顶点数据(S_Mesh* me, const S_UI32Array* index, S_Vec3Array* data, int32 成员);
//void f_surface_get网格法线数据(S_Mesh* me, const S_UI32Array* index, S_Vec3Array* data);
void f_surface_set网格顶点数据(S_Mesh* me, const S_UI32Array* index, const S_Vec3Array* data, int32 成员);


void f_surface_push顶点(S_Mesh* mesh, const std::vector<vec3>& vert);
void f_surface_push索引(S_Mesh* mesh, const std::vector<uint32>& index);

void f_surface_fill纹理坐标索引(S_Mesh* mesh, const std::vector<uint32>& index);

Inline uint32 f_surface_fill层纹理坐标(S_Mesh* mesh, const std::vector<vec2>& data) {
	f_buf_gresize(*mesh->m_UV, data.size());
	f_gbuf_fill(*mesh->m_UV, data.data(), 0, data.size());
	return mesh->m_UV->m_Mem.m_偏移;
}

Inline void f_surface_fill纹理坐标索引(S_Mesh* mesh, const std::vector<uvec3>& index) {
	f_buf_gresize(*mesh->m_UV索引, index.size() * 3);
	f_gbuf_fill(*mesh->m_UV索引, index.data(), 0, index.size() * 3);
}

Inline void f_surface_fill纹理坐标索引(S_Mesh* mesh, const std::vector<uvec3> index[8]) {
	f_buf_gresize(*mesh->m_UV索引, 0);

	uint32 offset = mesh->m_UV索引->m_Mem.m_偏移;
	//uint32 offset = 0;
	for (uint32 i = 0; i < 8; ++i) {
		switch (i) {
		case 0: mesh->m_几何属性.uvIndexOffset0 = offset; break;
		case 1: mesh->m_几何属性.uvIndexOffset1 = offset; break;
		case 2: mesh->m_几何属性.uvIndexOffset2 = offset; break;
		case 3: mesh->m_几何属性.uvIndexOffset3 = offset; break;
		case 4: mesh->m_几何属性.uvIndexOffset4 = offset; break;
		case 5: mesh->m_几何属性.uvIndexOffset5 = offset; break;
		case 6: mesh->m_几何属性.uvIndexOffset6 = offset; break;
		case 7: mesh->m_几何属性.uvIndexOffset7 = offset; break;
		default:
			break;
		}

		uint32 num = index[i].size();
		if (num) {
			++mesh->m_几何属性.uvLayerNum;
			offset += index[i].size();
		}
		
		f_buf_push_back(*mesh->m_UV索引, index[i]);
	}
}

void f_surface_fill绘制区间(S_Mesh* mesh, const std::vector<S_VkDrawIndirectCommand>& indirect);
void f_surface_fill绘制区间(S_Mesh* mesh, const std::vector<S_VkDrawIndexedIndirectCommand>& indirect);

uint32 f_surface_add间接绘制(S_Mesh* mesh, const S_VkDrawIndirectCommand& indirect);
uint32 f_surface_add间接绘制(S_Mesh* mesh, const S_VkDrawIndexedIndirectCommand& indirect);
void f_surface_mov绘制区间(S_Mesh* mesh, uint32 loc);
void f_surface_set间接绘制区间(S_Mesh* mesh, const S_VkDrawIndirectCommand& indirect, uint32 loc);

Inline S_VkDrawIndirectCommand f_surface_get间接绘制区间(S_Mesh* mesh, uint32 loc) {
	return f_buf_at_Indirect(*mesh->m_间接, loc);
}


Inline void f_surface_清空顶点数据(S_Mesh* mesh) {
	mesh->f_Clear();
}
Inline void f_surface_清空索引数据(S_Mesh* mesh) {
	mesh->f_Clear索引();
}





void f_surface_fill顶点数据(S_Surface2D* mesh, const std::vector<vec2>& data);
void f_surface_fill颜色(S_Mesh* mesh, const S_RGBA8UI& color, uint32 实例S, uint32 数量);

void f_surface_get顶点数据(S_Mesh* mesh, std::vector<S_VN>& data);
void f_surface_get顶点坐标(S_Mesh* mesh, std::vector<vec3>& data);
void f_surface_get顶点法线(S_Mesh* mesh, std::vector<vec3>& data);
void f_surface_get纹理坐标(S_Mesh* mesh, std::vector<vec2>& data);
void f_surface_get顶点索引(S_Mesh* mesh, std::vector<uvec3>& data);
void f_surface_get顶点索引(S_Mesh* mesh, std::vector<uint32>& data);
vec3 f_surface_get顶点坐标(S_Mesh* mesh, const Mat44f& mat, uint32 id);
vec3 f_surface_get全局偏移顶点坐标(S_Mesh* mesh, const Mat44f& mat, uint32 id);




void f_surface_合并(const std::vector<S_Mesh*>& meshs, S_Mesh& mesh);
void f_surface_数组合并(std::vector<S_VN>& data, const DEF_3Fs& v, const DEF_3Fs& n);
void f_surface_数组合并(std::vector<S_VC>& data, const DEF_3Fs& v, const std::vector<S_RGBA8UI>& color);
void f_surface_数组合并(std::vector<S_VNT1>& data, const DEF_3Fs& v, const DEF_3Fs& n, const DEF_2Fs& t);
void f_surface_数组合并(std::vector<S_VNT1>& data, const DEF_3Fs& v, const DEF_2Fs& t);
void f_surface_计算三角形球体包围盒(S_Mesh* mesh, std::vector<S_VecSphere>& 包围盒);
void f_surface_计算面中心点(S_Mesh* mesh, std::vector<vec3>& 中心点);
void f_surface_计算面法线(S_Mesh* mesh, std::vector<vec3>& 法线);
void f_surface_计算面平滑法线(S_Mesh* mesh, S_点距八叉树* t);
void f_surface_变换(S_Mesh* mesh, const S_Tranform& t);
S_Bounding f_surface_计算包围盒(S_Mesh* mesh, const Mat44f* mat = nullptr);
S_Bounding f_surface_计算包围盒(S_Mesh* mesh, uint32 vertOffset, uint32 vertNum);
vec3 f_surface_计算包围盒大小(S_Mesh* mesh, const Mat44f& mat);
Inline vec3 f_surface_get包围盒大小(S_Mesh* mesh, const Mat44f& mat) { return mat * mesh->m_包围盒.size; }
void f_surface_计算自动权重(S_Mesh* me, const Mat44f& mat, S_骨架* 骨架, float32 封套延申长度 = 0.3);
void f_surface_构建顶点相连面索引(S_Mesh* me, std::vector<std::vector<uint32>>& 顶点相邻面);
void f_surface_计算网格三角形法线(vec3* p顶点, uvec3* p索引, uint32* index, int32 num);
void f_surface_计算面平滑法线(S_Mesh* mesh, const std::vector<std::vector<uint32>>& 顶点相邻面);
void f_surface_应用变换(S_Mesh* mesh, const Mat44f& mat);
vec3 f_surface_变换包围盒(vec3 size, const Mat44f& mat);
bool f_surface_框选线段(S_Mesh* mesh, const Mat44f& mat, const vec4 平面[5]);
bool f_surface_框选线框(S_Mesh* mesh, const Mat44f& mat, const vec4 平面[5]);
bool f_surface_框选包围盒(S_Mesh* me, const Mat44f& mat, const vec4 平面[5]);

void f_surface_网格内点(S_Mesh* me, const Mat44f& mat, const S_Vec3Array* vert, S_BoolArray* 是内部, bool 反向);



typedef struct {
	vec3	相交坐标;
	float32	相交距离;
	uint32	元素索引;
}S_拾取信息;

//typedef struct {
//	Mat44f	变换矩阵;
//	vec4	射线起点;
//	vec4	射线方向;
//}S_Gpu实例拾取信息;

struct S_Gpu相交拾取计算 {
	S_GPU计算* m_GpuCtx_坐标_法线_UV;
	S_GPU计算* m_GpuCtx_坐标_法线;
	S_GPU计算* m_GpuCtx_坐标_颜色;
	S_GPU计算* m_GpuCtx_坐标;
	S_板载缓存* m_属性参数;
	S_板载缓存* m_相交数据;
	S_板载缓存* m_参数元素[4];
	uint8		m_布局位置[4];

	S_MeshPick  m_数据偏移;

	S_Gpu相交拾取计算(S_设备环境& ctx);

	uvec3 f_updateGPU参数(S_板载缓存* 顶点, S_GPU内存块索引& 索引, S_Pick& info, E_顶点组合标志 顶点标志);
	//void f_run();
};

//bool f_surface_射线面相交(S_Mesh* mesh, const Mat44f& mat, const vec3& s, const vec3& e, vec3& 交点, float32& min距离);
bool f_surface_射线面相交(S_Mesh* mesh, const Mat44f& mat, float32 独立缩放, const vec3& s, const vec3& dir, vec3& 交点, float32& min距离);
S_面拾取 f_surface_射线面相交(S_Mesh* mesh, const Mat44f mat[2], const S_MeshTranformProp& 间接属性, const uvec2& Offset_num, const vec3& s, const vec3& dir);

S_线拾取 f_surface_线段相交(S_Mesh* mesh, const Mat44f mat[2], const S_MeshTranformProp& 间接属性, const uvec2& Offset_num, vec3 s, const vec3& dir, float32 最小相交距离);
S_线拾取 f_surface_线段相交(S_Mesh* mesh, const Mat44f& mat, const vec3& s, const vec3& dir, float32& 距离, uint32 实例);

S_拾取信息	f_surface_Gpu射线拾取面(S_Mesh* m, const vec3& s, const vec3& e, Mat44f& 变换);

int32 f_surface_线相交(S_Mesh* mesh, const Mat44f& mat, const vec3& s, const vec3& e, float32& 距离);

vec3 f_surface_从面计算法线(const vec3& v0, const vec3& v1, const vec3& v2);


Vec3 f_SampleSDFGrad(const float* sdf, uvec3& dim, ivec3& xyz);
void f_fromMesh创建体素(S_体素& vo, const S_Mesh* srcMesh, vec3 移动, vec3 旋转, vec3 缩放, float 间距, float jitter = 0.005f);
void f_fromMesh创建体素(S_域区& vo, const S_Mesh* srcMesh, vec3 移动, vec4 旋转, vec3 缩放, float 间距);

void f_surface_构建光追底层加速结构(S_Mesh* me, E_物体类型 ObType);




void f_load网格(FILE* f, S_Mesh* obj, uint32 顶点配置标志);
void f_save网格(FILE* f, S_Mesh* obj);
S_Mesh* f_surface_create预设虚拟体();











template<typename T>
inline uint16 f_vg_genGPU缓存参数(S_2D画布* s, uint32 num) {
	S_板载缓存* mat = f_buf_create板载缓存(s->m_Ctx, sizeof(T), E_板载缓存类型::e_SSBO, 1);
	std::vector<T> data(DEF_Max(1, num));
	f_buf_fill板载缓存(mat, data, E_板载缓存类型::e_SSBO);

	if (num <= 0) mat->m_Size = 0;

	s->m_扩展GPU参数.push_back(mat);
	return uint16(s->m_扩展GPU参数.size() - 1);
}


template<typename T>
inline void f_vg_add参数实例(S_2D画布* s, uint16 eID, uint32 num) {
	std::vector<T> v(num);
	f_buf_push_back<T>(s->m_扩展GPU参数[eID], v);
	//f_resize板载缓存_Up(s->m_扩展GPU参数[eID], )
}

template<typename T>
inline void f_vg_erase参数实例(S_2D画布* s, uint16 eID, uint32 offset) {
	s->m_扩展GPU参数[eID]->f_map();
	f_板载缓存_remove<T>(s->m_扩展GPU参数[eID], offset);
	s->m_扩展GPU参数[eID]->f_unmap();
}

template<typename T>
inline void f_vg_erase参数实例(S_2D画布* s, uint16 eID, uint32* e, uint32 num) {
	s->m_扩展GPU参数[eID]->f_map();
	f_板载缓存_remove<T>(s->m_扩展GPU参数[eID], e, num);
	s->m_扩展GPU参数[eID]->f_unmap();
}











void f_begin绘制2D图形(S_2D画布* s);
void f_end绘制2D图形(S_2D画布* s);

void f_vg_记录元素(S_2D画布* s);
//uvec2 f_get2D元素区间(S_2D画布* s);

//uint16 f_vg_gen顶点(S_2D画布* s, uint32 num = 1);
//uint16 f_vg_gen图元(S_2D画布* s, uint32 num = 1);
//uint16 f_vg_gen变换(S_2D画布* s, uint32 num = 1);
//uint16 f_vg_gen颜色(S_2D画布* s, uint32 num = 1);

uint16 f_vg_gen属性(S_2D画布* s);
uint16 f_vg_gen渐变颜色(S_2D画布* s);
uint16 f_vg_gen渐变梯度(S_2D画布* s);
uint16 f_vg_gen连接点属性(S_2D画布* s);
uint16 f_vg_gen连接线变换(S_2D画布* s, uint32 num = 1);

S_板载缓存* f_vg_gen曲线(S_2D画布* s);
S_板载缓存* f_vg_gen曲线点索引(S_2D画布* s);
S_板载缓存* f_vg_gen颜色256(S_2D画布* s);


S_板载缓存* f_vg_gen属性(S_设备环境& m_Ctx);
Inline void f_vg_set属性(S_板载缓存* buf, const S_2D顶点属性& mat) {
	f_buf_set(buf, 0, mat);
}
S_GPU内存块索引* f_vg_gen2D变换(S_2D画布* s, uint32 num = 0);
S_GPU内存块索引* f_vg_gen2D颜色(S_2D画布* s, uint32 num = 0);
S_GPU内存块索引* f_vg_gen线属性a(S_2D画布* s);

S_GPU内存块索引* f_vg_gen色轮属性(S_设备环境& m_Ctx);
S_GPU内存块索引* f_vg_gen渐变控制(S_设备环境& m_Ctx);
S_GPU内存块索引* f_vg_gen渐变属性(S_设备环境& m_Ctx);

inline uint16 f_vg_gen文本ID(S_2D画布* s) {
	return f_vg_genGPU缓存参数<int32>(s, 1);
}


//S_GPU内存块索引* f_vg_gen纹理属性(S_设备环境& m_Ctx);
//S_GPU内存块索引* f_vg_gen2D颜色2(S_2D画布* s, uint32 num = 0);
//S_板载缓存* f_vg_gen图元ID(S_2D画布* s);

//inline uint16 f_vg_gen2颜色(S_2D画布* s) {
//	return uint16(f_vg_genGPU缓存参数<uvec2>(s, 1));
//}
//inline uint16 f_vg_gen3颜色(S_2D画布* s) {
//	return f_vg_genGPU缓存参数<uvec3>(s, 1);
//}
//inline uint16 f_vg_gen4颜色(S_2D画布* s) {
//	return f_vg_genGPU缓存参数<uvec4>(s, 1);
//}

//inline uint16 f_vg_gen图标UVID(S_2D画布* s) {
//	return f_vg_genGPU缓存参数<float32>(s, 0);
//}








uint16 f_vg_gen单色凸边形填充(S_2D画布* s, uint16 图元, uint16 变换, uint16 颜色, uint16 属性);
uint16 f_vg_gen单色凸边形描边(S_2D画布* s, uint16 图元, uint16 变换, uint16 颜色, uint16 属性, float32 线宽 = 1.0f);
uint16 f_vg_gen刻度线(S_2D画布* s, uint16 属性, float32 线宽 = 1.0f);
uint16 f_vg_gen填充凸边形(S_2D画布* s, uint16 图元, uint16 变换, uint16 颜色, uint16 属性, E_笔刷类型 笔刷类型);
//S_凸边图元	f_vg_gen凸边填充图元(S_2D画布* s, const S_凸边图元& 链接元素);
S_凸边图元	f_vg_gen凸边图元(S_2D画布* s, const S_凸边图元& 链接元素);
//S_凸边图元	f_vg_gen凸边纹理图元(S_2D画布* s, const S_凸边图元& 链接元素);
//S_凸边图元	f_vg_gen纹理图元(S_2D画布* s, const S_凸边图元& 链接元素);
S_渐变图元	f_vg_gen渐变图元(S_2D画布* s, const S_渐变图元& 链接元素);

uint16 f_vg_画行文本(S_2D画布* s, uint16 字体ID, uint16 变换, uint16 颜色, uint16 属性, uint16 字号, std::string 字体名称);
uint16 f_vg_画行文本(S_2D画布* s, S_板载缓存* 字体ID, S_板载缓存* 变换, S_板载缓存* 颜色, uint16 属性, uint16 字号, std::string 字体名称);

uint16 f_vg_画间接凸边形(S_2D画布* s, S_凸边图元& 图元, E_填充模式 模式, float32 线宽 = 1.0);
uint16 f_vg_画条纹纹理(S_2D画布* s, S_凸边图元& 图元, E_填充模式 模式);
uint16 f_vg_画色轮(S_2D画布* s, S_凸边图元& 图元);
uint16 f_vg_画渐变(S_2D画布* s, S_凸边图元& 图元);
//uint16 f_vg_画纹理(S_2D画布* s, S_凸边图元& 图元, S_纹理* 纹理);
uint16 f_vg_画动态线(S_2D画布* s, uint16 属性, float32 线宽 = 1.0);
uint16 f_vg_画网格刻度线(S_2D画布* s, uint16 属性, float32 线宽 = 1.0f);
uint16 f_vg_画曲线点(S_2D画布* s, uint16 属性, S_板载缓存* 曲线点);
uint16 f_vg_画曲线(S_2D画布* s, uint16 属性, S_板载缓存* 曲线点, S_板载缓存* 曲线点ID, float32 线宽);
uint16 f_vg_画曲线(S_2D画布* s, uint16 属性, S_板载缓存* 曲线点颜色, float32 线宽, bool 多曲线 = false);
uint16 f_vg_画噪波(S_2D画布* s, uint16 属性);
uint16 f_vg_画纹理(S_2D画布* s, uint16 属性, S_纹理* 纹理);
uint16 f_vg_画表格(S_2D画布* s, S_板载缓存* 属性);
uint16 f_vg_画矢量线(S_2D画布* s, S_板载缓存* 属性);
uint16 f_vg_画园公切线链接线(S_2D画布* s, uint16 属性, float32 线宽 = 1.0);


//uint16 f_vg_gen单色描边(S_2D画布* s, uint16 图元, uint16 变换, uint16 颜色, uint16 属性);
//S_2D笔刷 f_vg_gen渐变描边(S_2D画布* s, uint16 变换, uint16 颜色, uint16 梯度, uint16 属性);
//S_2D笔刷 f_vg_gen单色填充(S_2D画布* s, uint16 变换, uint16 颜色, uint16 属性);
//S_2D笔刷 f_vg_gen渐变填充(S_2D画布* s, uint16 变换, uint16 颜色, uint16 梯度, uint16 属性);
S_2D笔刷 f_vg_gen单色阴影(S_2D画布* s, uint16 变换, uint16 颜色, uint16 属性);

//S_2D笔刷 f_vg_gen图标笔刷(S_2D画布* s, uint16 变换, uint16 颜色, uint16 属性, uint16 UV, std::string group);
//S_2D笔刷 f_vg_gen纯纹理图标笔刷(S_2D画布* s, uint16 变换, uint16 颜色, uint16 属性, uint16 UV, std::string group);
S_2D笔刷 f_vg_gen图像笔刷(S_2D画布* s, uint16 变换, uint16 属性, S_纹理* 纹理);
S_2D文本对象 f_vg_gen文本笔刷(S_2D画布* s, uint16 变换, uint16 颜色, uint16 属性, uint16 字体ID, std::string 字体名称, uint16 字号);
S_2D笔刷 f_vg_gen文本块笔刷(S_2D画布* s, uint16 变换, uint16 颜色, uint16 属性, const S_Font& 字体);
S_2D笔刷 f_vg_gen渐变背景纹理笔刷(S_2D画布* s, uint16 属性, uint16 变换, uint16 颜色, uint16 梯度, S_纹理* 纹理);
S_2D笔刷 f_vg_gen棋盘格背景纹理笔刷(S_2D画布* s, uint16 属性, uint16 变换, uint16 颜色, uint16 梯度, S_纹理* 纹理);
S_2D笔刷 f_vg_gen条纹笔刷(S_2D画布* s, uint16 属性, uint16 变换, uint16 颜色);


//S_2D笔刷 f_vg_gen过程纹理描边(S_2D画布* s);
//S_2D笔刷 f_vg_gen过程纹理填充(S_2D画布* s);
//S_2D笔刷 f_vg_gen外部纹理描边(S_2D画布* s);
//S_2D笔刷 f_vg_gen外部纹理填充(S_2D画布* s);
S_2D笔刷 f_vg_gen临时连接线笔(S_2D画布* s, uint16 变换, uint16 颜色, uint16 属性);
S_2D笔刷 f_vg_gen连接点笔(S_2D画布* s, uint16 变换, uint16 颜色, uint16 属性, uint16 配置);
//void f_vg_set填充颜色(S_2D画布* s, const vec4& color);



//uint16 f_vg_绘制点集(S_2D画布* s, const std::vector<vec2>& point, bool 是否开始新图元 = true);
uint16 f_vg_绘制矩形(S_2D画布* s, S_2D笔刷& 笔刷, const vec4& point, bool 是否填充, bool 是否开始新图元 = true);
uint16 f_vg_绘制矩形(S_2D画布* s, S_2D笔刷& 笔刷, bool 是否填充, float32 线宽=1.0f, bool 是否开始新图元=true);
uint16 f_vg_绘制线(S_2D画布* s, std::vector<vec2>& point, float32 线宽, bool 是否开始新图元 = true);
uint16 f_vg_绘制圆角矩形(S_2D画布* s, S_2D笔刷& 笔刷, const vec4& point, float32 半径, bool 是否填充, float32 线宽 = 1.0f, bool 是否开始新图元 = true);

//uint16 f_vg_绘制圆角矩形(S_2D画布* s, S_2D笔刷& 笔刷, bool 是否填充);



uint16 f_vg_画连接点(S_2D画布* s, S_2D笔刷& 笔刷, bool 是否开始新图元 = true);
uint16 f_vg_画圆形(S_2D画布* s, S_2D笔刷& 笔刷, float32 半径, bool 是否填充, bool 是否开始新图元 = true);
//uint16 f_vg_画图标(S_2D画布* s, S_2D笔刷& 笔刷, bool 是否开始新图元 = true);
uint16 f_vg_画单色图标(S_2D画布* s, uint16 属性, std::string 图标集);
uint16 f_vg_画图标(S_2D画布* s, uint16 属性, std::string 图标集);
uint16 f_vg_画文本(S_2D画布* s, S_2D笔刷& 笔刷, bool 是否开始新图元 = true);
uint16 f_vg_画3D视口(S_2D画布* s, S_2D笔刷& 笔刷, bool 是否开始新图元 = true);
uint16 f_vg_画纹理面(S_2D画布* s, S_2D笔刷& 笔刷);


void f_vg_set绘制线(S_2D画布* s, uint16 eID, uint32 offset, const vec2& point);
void f_vg_set绘制线(S_2D画布* s, uint16 eID, uint32 num);




//void f_vg_add实例(S_2D画布* s, uint16 eID, const std::vector<uint16>& nums);
void f_vg_set顶点数量(S_2D画布* s, uint16 eID, int32 num);
//void f_vg_set实例数量(S_2D画布* s, int32 num);
void f_vg_set实例数量(S_2D画布* s, uint16 eID, int32 num);
Inline uint32 f_vg_set绘制数量(S_2D画布* s, uint16 eID) {
	return s->m_surf[eID].m_实例数量;
}
//void f_vg_add只增顶点(S_2D画布* s, vec2* point);
void f_vg_set属性(S_2D画布* s, uint16 eID, vec2 缩放, vec2 位置偏移, int32 梯度, int32 图标间隔);



void f_vg_add变换实例(S_2D画布* s, uint16 eID, uint32 nums);
void f_vg_add单色实例(S_2D画布* s, uint16 eID, uint32 nums);
void f_vg_add遮罩实例(S_2D画布* s, uint16 eID, uint32 nums);




inline void f_vg_erase变换实例(S_2D画布* s, uint16 eID, uint32 num) {
	s->m_扩展GPU参数[eID]->f_map();
	f_板载缓存_remove<mat3X2>(s->m_扩展GPU参数[eID], num);
	s->m_扩展GPU参数[eID]->f_unmap();
}
inline void f_vg_erase单色实例(S_2D画布* s, uint16 eID, uint32 num) {
	s->m_扩展GPU参数[eID]->f_map();
	f_板载缓存_remove<uint32>(s->m_扩展GPU参数[eID], num);
	s->m_扩展GPU参数[eID]->f_unmap();
}

inline void f_vg_erase变换实例(S_2D画布* s, uint16 eID, uint32* e, uint32 num) {
	s->m_扩展GPU参数[eID]->f_map();
	f_板载缓存_remove<mat3X2>(s->m_扩展GPU参数[eID], e, num);
	s->m_扩展GPU参数[eID]->f_unmap();
}
inline void f_vg_erase单色实例(S_2D画布* s, uint16 eID, uint32* e, uint32 num) {
	s->m_扩展GPU参数[eID]->f_map();
	f_板载缓存_remove<uint32>(s->m_扩展GPU参数[eID], e, num);
	s->m_扩展GPU参数[eID]->f_unmap();
}
inline void f_vg_erase文本块(S_2D画布* s, uint16 eID, uint32* e, uint32 num, uint32 offset) {
	s->m_扩展GPU参数[eID]->f_map();
	f_buf_remove段_swapEnd<int32>(s->m_扩展GPU参数[eID], e, num, offset);
	s->m_扩展GPU参数[eID]->f_unmap();
}



inline bool f_vg_resize参数实例(S_2D画布* s, uint16 eID, uint32 num) {
	return f_resize板载缓存_Up(s->m_扩展GPU参数[eID], num);
}
inline void f_vg_resize间接参数(S_2D画布* s, uint16 元素, uint32 num) {
	f_buf_gresize(s->m_surf[元素].m_间接, num);
}



void f_vg_set属性(S_2D画布* s, uint16 eID, const S_2D顶点属性& mat);
void f_vg_set变换(S_2D画布* s, uint16 eID, uint32 offset, const mat3X2& mat);
void f_vg_set单色(S_2D画布* s, uint16 eID, uint32 offset, const S_RGBA8UI color);
void f_vg_setUV(S_2D画布* s, uint16 eID, uint16 icoID, uint32 offset, std::string iconame);

void f_vg_set颜色2(S_2D画布* s, uint16 eID, uint32 offset, const S_RGBA8UI colorA, const S_RGBA8UI colorB);
void f_vg_set纹理(S_2D笔刷* b, uint16 eID, S_纹理* text);
void f_vg_set纹理(S_2D画布* s, uint16 元素, uint16 eID, S_纹理* text);
//void f_vg_set间接绘制参数(S_2D画布* s, uint16 元素, uvec2 顶点偏移数量, uint32 变换偏移, uint32 实例数量);
void f_vg_set图元(S_2D画布* s, uint16 元素, uint32 偏移, uvec2 图元);

void f_vg_set单色(S_凸边图元& 图元, uint32 offset, const S_RGBA8UI color);


inline void f_vg_set梯度(S_2D画布* s, uint16 eID, vec2 dir, uint32 offset) {
	f_buf_set(s->m_扩展GPU参数[eID], offset, dir);
}

void f_vg_set纹理(S_2D笔刷& 笔刷, uint32 offset, S_纹理* 纹理);
S_板载缓存* f_vg_get属性(S_2D画布* s, uint16 ID);

std::wstring f_vg_set行文本(S_2D画布* s, uint32 纹理集, std::wstring text, uint32 偏移, float32 width, int32* text_ptr);
void f_vg_del文本段(S_2D画布* s, const S_2D文本对象& eID, uint32 offset, uint32 区偏移);
void f_vg_resize行文本(S_2D画布* s, const S_2D文本对象& eID, uint32 num, bool 冗余 = true);



void f_vg_set属性间隔成员(S_2D画布* s, uint16 eID, float32 v);




Inline S_CurvePoint* f_vg_map曲线坐标(S_板载缓存* b) {
	b->f_map();
	return (S_CurvePoint*)(b->m_mappedPtr);
}


inline void	f_vg_unmapGPU参数(S_2D画布* s, uint16 eID) {
	s->m_扩展GPU参数[eID]->f_unmap();
}

Inline S_VkDrawIndirectCommand* f_vg_map间接参数(S_2D画布* s, uint16 eID) {
	//return nullptr;
	return f_buf_Indirect_ptr(s->m_surf[eID].m_间接);
	//return (S_VkDrawIndirectCommand*)(s->m_surf[eID].m_间接->m_mappedPtr);
}



template<typename T>
inline T* f_vg_map绘制数据指针(S_2D画布* s, uint16 eID) {
	s->m_扩展GPU参数[eID]->f_map();
	return (T*)s->m_扩展GPU参数[eID]->m_mappedPtr;
}
inline void f_vg_unmap绘制数据指针(S_2D画布* s, uint16 eID) {
	s->m_扩展GPU参数[eID]->f_unmap();
}

template<typename T>
void f_vg_setGPU参数(S_2D画布* s, uint16 eID, uint32 offset, const T 参数) {
	f_buf_set(s->m_扩展GPU参数[eID], offset, 参数);
}

inline uint64		f_vg_get参数数量(S_2D画布* s, uint16 eID) {
	return s->m_扩展GPU参数[eID]->m_Size;
}

inline S_板载缓存*	f_vg_get参数指针(S_2D画布* s, uint16 eID) {
	return s->m_扩展GPU参数[eID];
}

//inline S_板载缓存* f_vg_get顶点指针(S_2D画布* s, uint16 eID) {
//	return s->m_surf[eID].m_顶点.m_Buf;
//}

inline S_板载缓存* f_vg_get属性指针(S_2D画布* s, uint16 eID) {
	return s->m_属性[eID];
}




void f_vg_关联凸边形颜色属性(const S_2D画布* s, S_2D画布* s2, uint16 层);



/******************************  纹理  *************************************/


bool f_vg_增量添加图标(S_2D画布* s, uint16 元素ID, uint16 UVID, uint32 offset, std::string iconame);

void f_vg_set图标(S_2D画布* s, uint32* icoUV, uint16 元素ID, uint16 UVID, uint32 offset, std::string iconame);

Inline float32 f_vg_get图标坐标(S_2D画布* s, uint16 元素ID, std::string iconame) {
	if (s->m_调色板->m_ICOs[s->m_surf[元素ID].m_纹理].m_Name.find(iconame) != s->m_调色板->m_ICOs[s->m_surf[元素ID].m_纹理].m_Name.end()) {
		return s->m_调色板->m_ICOs[s->m_surf[元素ID].m_纹理][iconame];
	}
	return 0;
}




/***************************** 多边形 *******************************/
S_多边形*    f_surface_创建多边形();
void         f_surface_清除多边形元素(S_多边形* 多边形);
void         f_surface_销毁多边形(S_多边形* 多边形);
S_多边形元素* f_surface_多边形桥接(S_多边形* poly, const S_边& edgeA, const S_边& edgeB);
S_Vec3Array*  f_surface_点桥接(const S_Vec3Array* a, const S_Vec3Array* b, S_UI32Array* index, S_uVec2Array* loop);
void         f_surface_多边形三角化(S_Mesh* mesh, const S_多边形* 多边形);
void         f_surface_合并顶点(S_多边形* 多边形, float32 最大距离 = 0.001);
void         f_surface_计算平滑法线(S_多边形* 多边形);
void         f_surface_计算三角形球体包围盒(S_多边形* 多边形, std::vector<S_VecSphere>& 包围盒);
S_多边形元素*  f_surface_边网格化(S_多边形* 多边形, S_边& 边, S_边& 倒角);
float32      f_surface_边长度(S_边& 边, vec3* vert);
void	     f_surface_边多点采样(S_边* 边,
	                              const vec2& 区间, 
							      float32 偏移,

							      float32 最小间隔,
							      float32 随机间隔,
							      float32 随机种子,
	                              
	                              //const vec3& 间隔_随机,
							      S_Vec3Array* 采样返回坐标,
							      S_Vec3Array* 采样返回向量);

void	     f_surface_边采样(S_边* 边, const vec2& 区间, float32 偏移, vec3& 采样返回坐标, vec3& 采样返回向量);


S_多边形元素*  f_surface_复制(S_多边形* self, S_多边形元素* 面元素, const vec3& loc, const vec3& rot, const vec3& scal, uint8 合并元素);
void           f_surface_多边形元素变换(S_多边形元素* 面元素, const vec3& loc, const vec3& rot, const vec3& scal);
void           f_surface_多边形元素组变换(S_多边形元素Array* 面元素, const S_Vec3Array* loc, const S_Vec3Array* rot, const S_Vec3Array* scal);
void           f_surface_多边形变换(S_多边形* self, const vec3& loc, const vec3& rot, const vec3& scal);
S_多边形Array* f_surface_复制多边形(S_多边形* 源, const vec3& loc, const vec3& rot, const vec3& scal);
S_多边形Array* f_surface_拷贝多边形(const S_多边形Array* 源, S_多边形Array* 目标, const S_Vec3Array* loc, const S_Vec3Array* rot, const S_Vec3Array* scal);
void           f_surface_释放元素组(S_多边形* self, S_多边形元素Array* 面元素);
//void          f_surface_销毁多边形元素(S_多边形元素* 面组);

S_多边形元素Array* f_surface_线实体化(S_边Array* 边, S_Vec3Array* 倒角, S_F32Array* 半径, const S_曲线& curve, int32 节点类型, int32 半径迭代方式 = 0);


uvec2        f_surface_添加多边形顶点(S_多边形* self, S_Vec3Array* verts, S_Vec3Array* normal);
uvec2        f_surface_添加多边形法线(S_多边形* 多边形, S_Vec3Array* verts);
uvec2        f_surface_添加多边形纹理坐标(S_多边形* 多边形, const S_Vec2Array* uv, const S_UI32Array* indexs, S_uVec2Array* range);
void         f_surface_设置边形顶点法线(S_多边形* 多边形, S_Vec3Array* verts, uint32 offset);
S_边*        f_surface_添加多边形边(S_多边形* self, uvec2 offset, int32 线模式);
S_面* f_surface_添加多边形面(S_多边形* self, uint32* index, uint32 num, uint32 offset = 0);
S_多边形元素* f_surface_添加多边形元素(S_多边形* self, S_Vec3Array* 顶点, S_UI32Array* 索引, S_uVec2Array* 环);
S_多边形元素* f_surface_从区间索引构建多边形面(S_多边形* self, uvec2 index, uvec2 UV环, uint32 uv层, bool 面朝向 = true);

void          f_surface_从索引构纹理面坐标(S_多边形* self, S_UI32Array* faceIndex, S_1DArray* uvIndex);
void          f_surface_取面索引(S_多边形* self, S_多边形元素* 面元素, S_1DArray* 索引);
void          f_surface_取面顶点(const S_面* 面元素, S_Vec3Array* 顶点);
void          f_surface_取面法线(const S_面* 面元素, S_Vec3Array* 法线);
void          f_surface_取面中心(const S_面* 面元素, S_Vec3Array* 中心);
void          f_surface_取面顶点法线(const S_面* 面元素, S_Vec3Array* 法线);
S_边*              f_surface_取多边形边(const S_多边形* self, uint32 ID);
void          f_surface_取多边形多个元素(S_多边形* self, S_UI32Array* 元素索引, S_多边形元素Array* 元素);
S_多边形元素* f_surface_取多边形元素(S_多边形* self, uint32 元素索引);
//S_面*         f_surface_取多边形面(S_多边形* self, S_多边形元素* 面元素, uint32 index);
//uint32        f_surface_取多边形元素面数量(S_多边形* self, S_多边形元素* 面元素);

void          f_surface_设置面顶点(const S_面* 面元素, const S_Vec3Array* 顶点);
void          f_surface_设置面顶点法线(const S_面* 面元素, const S_Vec3Array* 法线);
void          f_surface_设置面法线(const S_面* 面元素, const S_Vec3Array* 法线);
void          f_surface_设置面中心(const S_面* 面元素, const S_Vec3Array* 中心);

void          f_surface_设置元素UV环(S_多边形* self, S_多边形元素* 元素, S_uVec2Array* 环, uint32 uv层);
void          f_surface_设置元素组UV环(S_多边形* self, S_多边形元素Array* 元素, S_uVec2Array* 环, uint32 uv层);
void          f_surface_设置元素材质槽ID(S_多边形* self, const S_多边形元素* 元素, S_UI32Array* 槽ID);
void          f_surface_设置元素组材质槽ID(S_多边形* self, const S_多边形元素Array* 元素, S_UI32Array* 槽ID);


S_多边形元素* f_surface_构建预设多边形(S_多边形* poly, const uvec3& 细分, const vec3& 大小, uint8 类型);
void         f_surface_投影纹理坐标(S_多边形* poly, int32 投影类型, S_多边形元素* 面元素, const Mat44f& mat);


void         f_surface_多边形转网格(const S_多边形* 多边形, S_Mesh* 面网格, S_Mesh* 点网格, S_Mesh* 边网格, bool 计算平滑法线 = true);


void        f_surface_多边形保存(FILE* f, const S_多边形* 多边形);
void        f_surface_网格保存(FILE* f, const S_Mesh* me);
S_多边形*   f_surface_多边形加载(FILE* f);
S_多边形* f_surface_copy(const S_多边形* 多边形);
void      f_surface_copy(const S_多边形* 多边形, S_多边形* 目标多边形);







void f_mesh_清除网格元素中相同索引(S_UI32Array2D* 网格元素);




//废弃
//S_线拾取 f_surface_线段相交(S_Mesh* mesh, const Mat44f& mat, const vec3& s, const vec3& dir, float32& 距离, S_VkDrawIndexedIndirectCommand* indirect = nullptr);
//uint16 f_vg_绘制圆角矩形(S_2D画布* s, S_2D笔刷& 笔刷, bool 是否填充, float32 半径, float32 线宽 = 1.0f, bool 是否开始新图元 = true);
//uint16 f_vg_绘制半圆角矩形(S_2D画布* s, S_2D笔刷& 笔刷, float32 半径, E_方向 方向, bool 是否填充, float32 线宽 = 1.0f);

//uint16 f_vg_绘制多单元圆角矩形(S_2D画布* s, S_2D笔刷& 笔刷, uint16 单元数量, float32 半径, E_方向 dir, float32 线宽=1.0f, bool 是否开始新图元 = true);
//uint16 f_vg_绘制多单元圆角矩形(S_2D画布* s, S_2D笔刷& 笔刷, uint16 单元数量, E_方向 dir, float32 线宽 = 1.0f);

//void f_vg_add绘制线(S_2D画布* s, uint16 id, vec2* point, uint32 num);



//inline uint16 f_vg_gen文本ID(S_2D画布* s) {
//	static S_板载缓存* buf = f_buf_create板载缓存(s->m_Ctx, sizeof(int32), E_板载缓存类型::e_SSBO, 0);
//	s->m_扩展GPU参数.push_back(buf);
//	return (s->m_扩展GPU参数.size() - 1);
//}

/*Inline S_VkDrawIndirectCommand* f_surface_map绘制区间(S_Mesh* mesh) {
f_buf_map板载缓存<S_VkDrawIndirectCommand>(mesh->m_间接);
return (S_VkDrawIndirectCommand*)mesh->m_间接->m_mappedPtr;
}
Inline void f_surface_unmap绘制区间(S_Mesh* mesh) {
f_buf_unmap板载缓存(mesh->m_间接);
}*/


//uint16 f_vg_gen线属性(S_2D画布* s);
//uint16 f_vg_gen间接图元(S_2D画布* s, uint32 num = 1);
//void f_填充索引数据(S_Surface2D* mesh, const std::vector<uint32>& data);
//void f_set顶点数据(S_Mesh* mesh, const vec3& data, uint32 offset);


//Inline uint32* f_vg_map曲线ID(S_板载缓存* b) {
//	b->f_map();
//	return (uint32*)(b->m_mappedPtr);
//}
//Inline uint32* f_vg_map颜色256(S_板载缓存* b) {
//	b->f_map();
//	return (uint32*)(b->m_mappedPtr);
//}


//Inline mat3X2* f_vg_map变换(S_板载缓存* buf) {
//	buf->f_map();
//	return (mat3X2*)(buf->m_mappedPtr);
//}
//
//Inline uvec2* f_vg_map图元(S_板载缓存* buf) {
//	buf->f_map();
//	return (uvec2*)(buf->m_mappedPtr);
//}
//
//Inline uint32* f_vg_map单色(S_板载缓存* buf) {
//	buf->f_map();
//	return (uint32*)(buf->m_mappedPtr);
//}



//inline mat3X2* f_vg_map变换(S_2D画布* s, uint16 eID) {
//	s->m_扩展GPU参数[eID]->f_map();
//	return (mat3X2*)s->m_扩展GPU参数[eID]->m_mappedPtr;
//}
//inline uint32* f_vg_map单色(S_2D画布* s, uint16 eID) {
//	s->m_扩展GPU参数[eID]->f_map();
//	return (uint32*)s->m_扩展GPU参数[eID]->m_mappedPtr;
//}
//inline uvec2* f_vg_map图元(S_2D画布* s, uint16 eID) {
//	s->m_扩展GPU参数[eID]->f_map();
//	return (uvec2*)s->m_扩展GPU参数[eID]->m_mappedPtr;
//}
//inline uint32* f_vg_mapICO(S_2D画布* s, uint16 eID) {
//	s->m_扩展GPU参数[eID]->f_map();
//	return (uint32*)s->m_扩展GPU参数[eID]->m_mappedPtr;
//}
//Inline int32* f_vg_map字符(S_2D画布* s, uint16 eID) {
//	s->m_扩展GPU参数[eID]->f_map();
//	return (int32*)s->m_扩展GPU参数[eID]->m_mappedPtr;
//}
//Inline S_LineProp* f_vg_map线属性(S_2D画布* s, uint16 eID) {
//	s->m_扩展GPU参数[eID]->f_map();
//	return (S_LineProp*)s->m_扩展GPU参数[eID]->m_mappedPtr;
//}



/*Inline S_VkDrawIndirectCommand* f_vg_map间接参数(S_2D画布* s, uint16 eID) {
s->m_surf[eID].m_间接->f_map();
return (S_VkDrawIndirectCommand*)(s->m_surf[eID].m_间接->m_mappedPtr);
}
Inline void	f_vg_unmap间接参数(S_2D画布* s, uint16 eID) {
//s->m_surf[eID].m_间接->f_unmap();
}*/


/*inline float32 f_vg_getTexUV(S_2D画布* s, uint16 eID, std::string iconame) {
if (s->m_调色板->m_ICOs[s->m_surf[eID].m_纹理].m_Name.find(iconame) != s->m_调色板->m_ICOs[s->m_surf[eID].m_纹理].m_Name.end()) {
return s->m_调色板->m_ICOs[s->m_surf[eID].m_纹理][iconame];
}
return 0;
}*/





